 {
        
        var o = require("./UISoundManager.js");
        cc.Class({
            extends: require("./UIPopupBase.js"),
            properties: {},
            onLoad: function () {
                this.playMode = "xueliu";
            },
            start: function () {
                var e = this.getRulePanel();
                this.chooseGroups = e.getChildByName("chooseGroups"), this.toggles = this.chooseGroups.getComponentsInChildren(cc.Toggle);
                for (var t = 0; t < this.toggles.length; t++) {
                    var n = this.toggles[t].node;
                    n.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd.bind(this), this), this.originColor || (this.originColor = n.getComponentInChildren(cc.Label).node.color);
                }
                this.defaultConfig = this.collectRoomConfig(), this.refreshConfig(this.defaultConfig);
                for (var o = 0; o < this.chooseGroups.children.length; o++) this.refreshOneLine(o);
            },
            onTouchEnd: function (e) {
                o.playEffect("select");
                var t = e.target.parent.getSiblingIndex();
                this.refreshOneLine(t);
            },
            refreshOneLine: function (e) {
                for (var t = this.chooseGroups.children[e], n = 0; n < t.children.length; n++) {
                    var o = t.children[n].getComponentInChildren(cc.Label).node;
                    o && t.children[n].getComponent(cc.Toggle).isChecked ? o.color = cc.Color.RED : o && !t.children[n].getComponent(cc.Toggle).isChecked && (o.color = this.originColor);
                }
            },
            refreshConfig: function (e) {
                var t = this.chooseGroups, n = t.getChildByName("modeToggle");
                if (n) {
                    var o = "threeTiles", i = n.getChildByName("Toggle1");
                    e[o] ? i.getComponent(cc.Toggle).check() : i.getComponent(cc.Toggle).uncheck(),
                        o = "callTransfer", i = n.getChildByName("Toggle2"), e[o] ? i.getComponent(cc.Toggle).check() : i.getComponent(cc.Toggle).uncheck();
                }
                if (n = t.getChildByName("jiaBeiTContainer")) for (var a = 0; a < n.children.length; a++) a + 1 == e.wanFa ? n.children[a].getComponent(cc.Toggle).check() : n.children[a].getComponent(cc.Toggle).uncheck();
                if (n = t.getChildByName("dianGangTContainer")) for (var r = 0; r < n.children.length; r++) r + 1 == e.wanFa1 ? n.children[r].getComponent(cc.Toggle).check() : n.children[r].getComponent(cc.Toggle).uncheck();
                if (n = t.getChildByName("fanxingToggle")) {
                    var s = "quanyaojiuFan", l = n.getChildByName("Toggle1");
                    e[s] ? l.getComponent(cc.Toggle).check() : l.getComponent(cc.Toggle).uncheck(),
                        s = "duanyaojiuFan", l = n.getChildByName("Toggle2"), e[s] ? l.getComponent(cc.Toggle).check() : l.getComponent(cc.Toggle).uncheck(),
                        s = "jiangduiFan", l = n.getChildByName("Toggle3"), e[s] ? l.getComponent(cc.Toggle).check() : l.getComponent(cc.Toggle).uncheck(),
                        s = "clearDouble", l = n.getChildByName("Toggle4"), e[s] ? l.getComponent(cc.Toggle).check() : l.getComponent(cc.Toggle).uncheck(),
                        s = "tiandihuFan", l = n.getChildByName("Toggle5"), e[s] ? l.getComponent(cc.Toggle).check() : l.getComponent(cc.Toggle).uncheck(),
                        s = "haidilaoyueFan", l = n.getChildByName("Toggle6"), e[s] ? l.getComponent(cc.Toggle).check() : l.getComponent(cc.Toggle).uncheck();
                }
                if (n = t.getChildByName("fengDingTContainer")) for (var c = 0; c < n.children.length; c++) c + 1 == e.maxFan ? n.children[c].getComponent(cc.Toggle).check() : n.children[c].getComponent(cc.Toggle).uncheck();
                if (n = t.getChildByName("juShuTContainer")) for (var d = 0; d < n.children.length; d++) d + 1 == e.cardCount4 ? n.children[d].getComponent(cc.Toggle).check() : n.children[d].getComponent(cc.Toggle).uncheck();
            },
            onButtonClick: function (e, t) {
                switch (t) {
                    case "close":
                        this.OnPanelClose();
                        break;

                    case "selectXueliu":
                        console.log("select Xueliu"), this.playMode = "xueliu";
                        var n = !0;
                        this.exchangeSelected(n), this.refreshConfig(this.defaultConfig);
                        for (var o = 0; o < this.chooseGroups.children.length; o++) this.refreshOneLine(o);
                        break;

                    case "selectXueZhan":
                        console.log("select XueZhan"), this.playMode = "xuezhan";
                        n = !1;
                        this.exchangeSelected(n), this.refreshConfig(this.defaultConfig);
                        for (var i = 0; i < this.chooseGroups.children.length; i++) this.refreshOneLine(i);
                        break;

                    case "create":
                        console.log("create");
                        var a = this.collectRoomConfig();
                        Global.msgHandler.requestCreateRoom(a, this.playMode), this.OnPanelClose();
                }
            },
            exchangeSelected: function (e) {
                o.playEffect("select");
                var t = this.getRulePanel();
                if (null != t) {
                    var n = t.getChildByName("buttonXueLiu");
                    if (n) n.getChildByName("selected").active = e;
                    var i = t.getChildByName("buttonXueZhan");
                    if (i) i.getChildByName("selected").active = !e;
                }
            },
            getRulePanel: function () {
                var e = this.node.getChildByName("CommonPanel");
                if (null == e) return cc.log("collectRoomConfig: commonPanel == null"), null;
                var t = e.getChildByName("ruleChoose");
                return null == t ? (cc.log("collectRoomConfig: ruleChoose == null"), null) : t;
            },
            collectRoomConfig: function () {
                var e = null, t = this.getRulePanel();
                if (null != t) {
                    var n = {}, o = "", i = 0, a = t.getChildByName("chooseGroups");
                    if (a) {
                        var r = a.getChildByName("modeToggle");
                        r && ((e = r.getChildByName("Toggle1")) && e.getComponent(cc.Toggle).isChecked && (n[o = "threeTiles"] = 1),
                        (e = r.getChildByName("Toggle2")) && e.getComponent(cc.Toggle).isChecked && (n[o = "callTransfer"] = 1)),
                        (r = a.getChildByName("jiaBeiTContainer")) && (o = "wanFa", (e = r.getChildByName("Toggle1")) && e.getComponent(cc.Toggle).isChecked && (i = 1),
                        (e = r.getChildByName("Toggle2")) && e.getComponent(cc.Toggle).isChecked && (i = 2),
                        (e = r.getChildByName("Toggle3")) && e.getComponent(cc.Toggle).isChecked && (i = 3),
                            n[o] = i), (r = a.getChildByName("dianGangTContainer")) && (o = "wanFa1", (e = r.getChildByName("Toggle1")) && e.getComponent(cc.Toggle).isChecked && (i = 1),
                        (e = r.getChildByName("Toggle2")) && e.getComponent(cc.Toggle).isChecked && (i = 2),
                            n[o] = i), (r = a.getChildByName("fanxingToggle")) && ((e = r.getChildByName("Toggle1")) && e.getComponent(cc.Toggle).isChecked && (n[o = "quanyaojiuFan"] = 1),
                        (e = r.getChildByName("Toggle2")) && e.getComponent(cc.Toggle).isChecked && (n[o = "duanyaojiuFan"] = 1),
                        (e = r.getChildByName("Toggle3")) && e.getComponent(cc.Toggle).isChecked && (n[o = "jiangduiFan"] = 1),
                        (e = r.getChildByName("Toggle4")) && e.getComponent(cc.Toggle).isChecked && (n[o = "clearDouble"] = 1),
                        (e = r.getChildByName("Toggle5")) && e.getComponent(cc.Toggle).isChecked && (n[o = "tiandihuFan"] = 1),
                        (e = r.getChildByName("Toggle6")) && e.getComponent(cc.Toggle).isChecked && (n[o = "haidilaoyueFan"] = 1)),
                        (r = a.getChildByName("fengDingTContainer")) && (o = "maxFan", (e = r.getChildByName("Toggle1")) && e.getComponent(cc.Toggle).isChecked && (i = 1),
                        (e = r.getChildByName("Toggle2")) && e.getComponent(cc.Toggle).isChecked && (i = 2),
                        (e = r.getChildByName("Toggle3")) && e.getComponent(cc.Toggle).isChecked && (i = 3),
                            n[o] = i), (r = a.getChildByName("juShuTContainer")) && (o = "cardCount4", (e = r.getChildByName("Toggle1")) && e.getComponent(cc.Toggle).isChecked && (i = 1),
                        (e = r.getChildByName("Toggle2")) && e.getComponent(cc.Toggle).isChecked && (i = 2),
                        (e = r.getChildByName("Toggle3")) && e.getComponent(cc.Toggle).isChecked && (i = 3),
                            n[o] = i);
                    }
                    return cc.log("collectData: " + JSON.stringify(n)), n;
                }
            }
        })
    }